﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SessionHomework
{
    public partial class MainForm : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.Session.Add("Messages", new List<string>());
            }
        }

        protected void SubmitText_Click(object sender, EventArgs e)
        {
            string message= this.TextBoxInput.Text;
            List<string> messages = ((List<string>)this.Session["Messages"]);
            messages.Add(message);
            this.Session["Messages"] = messages;

            foreach (var item in messages)
            {
                this.LabelOutput.Text += item + "</br>";

            }
            Response.Write("</br>");

        }
    }
}